import dt from '@dt/dt'
import toolMgr from '@/biz/base/tool.js'
import Opt from '@/components/dt/info/Opt.js'

class DetailOpt extends Opt {

  constructor(info) {
    super(info)
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [{
        title: '撤场日期',
        key: 'realityWithdrawalDate',
        text: {
          type: 'date'
        }
      },
      {
        title: '最近编辑时间',
        key: 'recentEditTime',
        text: {}
      },
      {
        title: '撤场协议是否签署',
        key: 'isWithdrawalDealStr',
        col: 24,
        text: {}
      },
      {
        title: '撤场协议是否包含未结算房源明细',
        key: 'unSettlementRoomInfoStr',
        visible: this.info.isWithdrawalDeal == '1',
        text: {}
      },
      {
        title: '撤场协议附件',
        key: 'attachList',
        visible: this.info.isWithdrawalDeal == '1',
        tag: {
          type: 'text',
          options: this.info.attachList.map(i => ({
            key: i.imageURL,
            value: i.imageName
          })),
          click: (tag) => {
            toolMgr.downloadFile(tag.key, tag.value)
          }
        }
      },
      {
        title: '撤场协议说明',
        key: 'isWithdrawalDealExplain',
        col: 24,
        visible: this.info.isWithdrawalDeal == '0',
        text: {}
      },
      {
        title: '撤场原因',
        key: 'withdrawalReason',
        col: 24,
        text: {}
      },
      {
        title: '撤场原因说明',
        key: 'withdrawalExplain',
        col: 24,
        text: {}
      },
    ]
  }
}

export default DetailOpt
